package com.corhyfar.servlet;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.corhyfar.beans.ClienteTemporalDTO;
import com.corhyfar.dao.impl.ClienteTemporalDaoImpl;
import com.corhyfar.service.ClienteTemporalService;
import com.corhyfar.service.impl.ClienteTemporalServiceImpl;

/**
 * Servlet implementation class ListadoSolicitud
 */
@WebServlet("/ListadoSolicitud")
public class ListadoSolicitud extends HttpServlet {

	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
			public ListadoSolicitud() {
				super();
				// TODO Auto-generated constructor stub
			}
		
			/**
			 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
			 *      response)
			 */
			protected void doGet(HttpServletRequest request,
					HttpServletResponse response) throws ServletException, IOException {
				procesar(request, response);
			}
		
			/**
			 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
			 *      response)
			 */
			
			
			
			protected void doPost(HttpServletRequest request,
					HttpServletResponse response) throws ServletException, IOException {
				procesar(request, response);
			}

	private void procesar(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		ClienteTemporalService clienteTemporalService = new ClienteTemporalServiceImpl();

		List<ClienteTemporalDTO> lista = clienteTemporalService.listarClienteTemporal();

		if(lista==null){
			System.out.println("Lista esta vacia");
		}
		
		HttpSession misesion = request.getSession();
		misesion.setAttribute("listadito", lista);

	}

}
